<template>
  <div class="topic">
    <div class="topic-title">专题</div>

    <van-list
      class="topic-list"
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <div class="topic-item" v-for="item in topicList" :key="item.id">
        <img :src="item.scene_pic_url" alt="" />
        <p class="item-title">{{ item.title }}</p>
        <p class="item-sub">{{ item.subtitle }}</p>
        <span class="item-info">¥{{ item.price_info }}</span>
      </div>
    </van-list>
  </div>
</template>

<script>
import { listaction } from "@/api/topic/index";
export default {
  name: "Index",

  data() {
    return {
      topicList: [],
      loading: false,
      finished: false,
      start:1
    };
  },
  created() {},

  mounted() {},

  methods: {
    onLoad() {
      listaction({
        page:this.start
      })
      .then(res=>{
        // this.topicList = res.data
        this.topicList.push(...res.data);
        this.loading = false;
        this.start ++;

        if(res.page == res.total){
          this.finished = true
        }
      })
      
    },
  },
};
</script>

<style scoped lang="scss">
@import "../topic/scss/index.scss";
* {
  margin: 0;
  padding: 0;
}
</style>